/**
* 我的粉丝
* 链接：this.$router.push({path:'/fans'})
*/

<template>
  <div class="x-bg situation fans">
    <header-top :option="headerOption"></header-top>
    <Overview></Overview>
    <img src="~assets/images/bowen@3x.png" width="100%" height="40px">
    <Rockmen></Rockmen>
    <div style="height:50px"></div>
    <div class="update-subscribe-price">
      <button class="btn" @click.stop.prevent="setSubscribePrice">朕要修改订阅价格</button>
    </div>
    <subscribe-price-modal></subscribe-price-modal>
  </div>
</template>

<script>
  import Constant from 'common/constant'
  import LocalDAO from 'common/localDAO'
  import HeaderTop from 'components/HeaderTop'
  import Overview from 'components/dynamic/fans/Overview'
  import Rockmen from 'components/dynamic/fans/Rockmen'
  import SubscribePriceModal from 'components/modal/SubscribePriceModal'
  export default {
    data () {
      return {
        headerOption: {
          title: '我的粉丝',
          leftBtn: Constant.leftBtn.BACK,
          operations: [Constant.operation.SHARE],
          page: Constant.storage.SHARE_FANS
        }
      }
    },
    components: {
      HeaderTop,
      Overview,
      Rockmen,
      SubscribePriceModal
    },
    created () {
      this.init();
    },
    methods: {
      //设置分享页数据
      init () {
        let sharePage = LocalDAO.getShareFans();
        sharePage.adDownload = {userCode: LocalDAO.getUserCode()};
        LocalDAO.setShareFans(sharePage);
      },

      //设置订阅价格
      setSubscribePrice () {
        this.$store.dispatch('setModal', {visible: true,modalId: 'subscribePriceModal',callback: this.callback});
      },

      //设置订阅价格成功后回调函数
      callback (response) {
        if(response.error == 0){
          this.$root.eventHub.$emit('getSubscribePrice',response.subscribePrice);
        }
      }
    }
  }
</script>
